<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>创建合同订单</title>
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/common.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <script type="text/javascript">
    $(document).ready(function(){
    	$("#warehouseID").select2();
    	$("#rackID").select2();
    });
    
    function changeWarehouse() {
    	var warehouseID = $("#warehouseID").val();
    	param={"warehouseID":warehouseID};
    	$.post("${ctx}/slopwork/inbound/findRack",param,function(result){            
        	$("#rackHtml").html($(callBackHtml(result)).find("#rackHtml").html());
        	$("#rackID").select2();
        },'html');
	}
    
    //保存方法
    var saveForm={
         t:null,
         save:function(t){
              $(t).attr("disabled",true);
              this.t=t;
              // 表单验证
              $("#inputForm").validate({
                   fail: function(element,e) {  
                        $(saveForm.t).attr("disabled",false);
                   },
                   submitHandler: function() {
                	// 格式化，去除逗号
                        formUnFormat($("#inputForm"));
                	    var params = $("#inputForm").serialize();
                        $.post("${ctx}/slopwork/inbound/save",params,function(result){
                      	 // 提示信息
                           tipParent(result.message);
                           // 返回状态
                           if(result.statusCode==STATUSCODEOK){
                        	    window.parent.frames[2].clothesDetailList();
                                closeWin(); 
                           }else{
                                $(saveForm.t).attr("disabled",false);
                           }
                       },'json');
                   }
              });
              // 提交表单
              $("#inputForm").submit(); 
         } 
    }
    </script>
</head>
<form id="inputForm">
<body>   
<div  class="layerHeader clearfix">	      
    <p class="headerTitle"><spring:message code="inventory_detail_set_warehouseRack"/></p>    
    <div class="headerButton clearfix">
		  <button type="button" id="saveButton" onclick="saveForm.save(this)"><spring:message code="common_save" /></button>
          <!-- 取消 -->
          <button type="button" onclick="closeWin()"><spring:message code="purchaseAdvance_edit_cancle"/></button>
    </div>
</div>

<div id="showHtml" class="smOrderBox">
<input type="hidden" id="inventoryRequestDetailId" name="inventoryRequestDetailId" value="${slopworkInbound.inventoryRequestDetailId}"/>
<input type="hidden" id="id" name="id" value="${slopworkInbound.id}"/>
<input type="hidden" id="inventoryInOutKbn" name="inventoryInOutKbn" value="${slopworkInbound.inventoryInOutKbn}"/>
<input type="hidden" id="inventoryCategory" name="inventoryCategory" value="${slopworkInbound.inventoryCategory}"/>
<input type="hidden" id="styleId" name="styleId" value="${slopworkInbound.styleId}"/>
<input type="hidden" id="styleSize" name="styleSize" value="${slopworkInbound.styleSize}"/>
<input type="hidden" id="styleSizeGroup" name="styleSizeGroup" value="${slopworkInbound.styleSizeGroup}"/>
<input type="hidden" id="styleColor" name="styleColor" value="${slopworkInbound.styleColor}"/>
<input type="hidden" id="contractId" name="contractId" value="${slopworkInbound.contractId}"/>
<input type="hidden" id="indentId" name="indentId" value="${slopworkInbound.indentId}"/>
<input type="hidden" id="productionId" name="productionId" value="${slopworkInbound.productionId}"/>
<input type="hidden" id="requestRealQuantity" name="requestRealQuantity" value="${slopworkInbound.requestRealQuantity}"/>
    <div class="items clearfix showHtml">
        <div class="col-50 clearfix">
        <!-- 客户款号 -->
            <p class="tit"><spring:message code="slopworkInbound_detail_styleNo"/></p>
            <p>${slopworkInbound.customerStyleNo}</p>
        </div>
        <div class="col-50 clearfix ">
        <!-- 款式名称  -->
            <p class="tit"><spring:message code="slopworkInbound_detail_styleName"/></p>
            <p>${slopworkInbound.styleNameCn}</p>
        </div>
        
    </div>
    <div class="items clearfix">
        <div class="col-50 clearfix">
        <!-- 申请数量  -->
            <p class="tit"><spring:message code="inventory_detail_set_requestQuantity"/></p>
            <p><fmt:formatNumber value="${slopworkInbound.requestQuantity}" pattern="#,##0.#####"/></p>
        </div>
        <div class="col-50 clearfix haveToBox">
             <!-- 入库数量  -->
             <p class="tit"><spring:message code="inventory_detail_set_inventoryQuantity"/></p>
             <input type="tel" maxlength="12" style="width: 120px;" id="realQuantity" name="realQuantity" onblur="formatNumber(this);" onfocus="unFormat(this);" data-rule-required="true"  data-msg-required="<spring:message code="inventory_detail_error_msg_inventoryQuantity"/>">
             <p class="haveTo">*</p>
        </div>
    </div>
    <div class="items clearfix haveToBox" >        	
         <div class="col-50 clearfix">
         <!-- 仓库名称  -->
             <p class="tit"><spring:message code="inventory_detail_set_warehouseName"/></p>
             <select id="warehouseID" name="warehouseID" onchange="changeWarehouse();" style="width: 150px;" data-rule-required="true"  data-msg-required="<spring:message code="inventory_detail_error_msg_warehouseName"/>">
             	<option value=""><spring:message code="customer_pleaseChoose"/></option>
             	<c:forEach items="${slopworkInbound.warehouseList}" var="warehouse">
             		<option value="${warehouse.warehouseID}">${warehouse.warehouseName}</option>
             	</c:forEach>
             </select>
             <p class="haveTo">*</p>
         </div>
     </div>
    
     <div id="rackHtml" class="items clearfix haveToBox">        	
         <div class="col-50 clearfix">
         <!-- 货架位置  -->
             <p class="tit"><spring:message code="inventory_detail_set_rackPlace"/></p>
             <select id="rackID" name="rackID" style="width: 150px;" data-rule-required="true"  data-msg-required="<spring:message code="inventory_detail_error_msg_rackPlace"/>">
             	<option value=""><spring:message code="customer_pleaseChoose"/></option>
             	<c:forEach items="${slopworkInbound.rackList}" var="rack">
             		<option value="${rack.rackID}">${rack.rackPlace}</option>
             	</c:forEach>
             </select>
    			<p class="haveTo">*</p>
         </div>
     </div>
     <div class="items clearfix" >        	
         <div class="col-50 clearfix">
         <!-- 备注  -->
             <p class="tit"><spring:message code="slopworkInbound_detail_create_remark"/></p>
             <textarea maxlength="100" style="width:150px;" id="remarks" name="remarks"></textarea>
             </select>
         </div>
     </div>
</div>
</body>
</form>
</html>
